<<!include:header>>
    <style>
        .imageStyle {
            max-width: 100%;
        }
    </style>
    <section class="hero-section litte-header">
        <div class="container">
            <div class="filtrate mb40 ft15    ">
                <div class="filtrate mb40 ft15   " style="margin-top:150px;color:#fff">

                </div>
            </div>
        </div>

    </section><!-- End Hero -->
    <div class="container" style="margin-top:50px;">
        <div class="row" style="width: 100%;">


            <h3 class="text-center col-12" id="newsTitle"> </h3>
        </div>
        <div class="row" style="width: 100%; margin-top: 10px;">
            <div class="text-center col-xs-12 col-sm-12 col-lg-5">
                <span id="author">作者： </span>
                <span id="time" style="margin-left: 20px;">发布时间： </span>
                <span id="review" style="margin-left: 20px;">阅读： 人</span>
                <span id="downfile" style="margin-left: 20px;"></span>
            </div>
            <div class="text-right col-xs-12 col-sm-12 col-lg-5">

                <span>分享到：</span>
                <a href="javascript:void(window.open('http://connect.qq.com/widget/shareqq/index.html?url='+encodeURIComponent(document.location.href)+'&amp;title=分享给好友'));"
                    title="分享给QQ好友" style="padding: 10px 10px;" class="bg-blue  ">
                    <i class="iconfont icon-QQ font-white"><img src="/upload/1/platform/2020-07-16/fenxiang_07.png"
                            alt=""></i></a>
                <a href="javascript:void(window.open('http://service.weibo.com/share/share.php?url='+encodeURIComponent(document.location.href)+'&amp;title=分享给好友'));"
                    title="分享到新浪微博" style="padding: 10px 10px;" class="bg-red  ">
                    <i class="iconfont icon-unie61d font-white"><img src="/upload/1/platform/2020-07-16/fenxiang_11.png"
                            alt=""></i></a>
                <a href="javascript:void(window.open('https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href)+'&amp;title=分享给好友'));"
                    title="分享到QQ空间" style="padding: 10px 10px;" class="bg-yellow  ">
                    <i class="iconfont icon-qqkongjian font-white">
                        <img src="/upload/1/platform/2020-07-16/fenxiang_09.png" alt=""></i></a>


            </div>

        </div>
        <hr color="#f7f7f7" style="margin-top:10px; margin-bottom:20px;  border: 1px solid #d9d9d9">
        <div class="row">
            <div class=" col-xs-12 col-sm-12 col-md-9 col-lg-8">
                <div class="row"
                    style="width: 100%; margin:10px;   padding: 30px; background-color:#f0f0f0; min-height: 100px;"
                    id="description">

                </div>
                <div class="row"
                    style="width: 100%; margin:10px;  border:1px solid #f1f1f1 ;  padding: 10px; min-height: 500px;"
                    id="content">

                </div>
            </div>

            <div class="text-right col-xs-12 col-sm-12 col-md-3 col-lg-4">
                <div class="list-group">
                    <span class="text-center">焦点关注</span>
                    <hr style="width: 100%;" />
                    <a href="#" class="list-group-item text-left" style="border:ivory">Dapibus ac facilisis in</a>
                    <a href="#" class="list-group-item text-left" style="border:ivory">Morbi leo risus</a>
                    <a href="#" class="list-group-item text-left" style="border:ivory">Porta ac consectetur ac</a>
                    <a href="#" class="list-group-item text-left" style="border:ivory">Vestibulum at eros</a>
                    <a href="#" class="list-group-item text-left" style="border:ivory">Morbi leo risus</a>
                </div>

            </div>

        </div>




    </div>



    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js"></script>
    <script>

        var id = 0;
        var newsTitle = "";
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == "id") {
                id = pair[1];
                break;
            }
        }
        function time2String(date) {
            var year = date.getFullYear();
            var month = (date.getMonth() + 1).toString();
            var day = (date.getDate()).toString();
            if (month.length == 1) {
                month = "0" + month;
            }
            if (day.length == 1) {
                day = "0" + day;
            }
            return year + "-" + month + "-" + day;
        }

        function formatContent(content) {
            ///word/g  0px 0px 44px 2px rgba(43, 43, 43, 0.19)
            if (content) {
                return content.replace(
                    /<img /g,
                    "<img  class='imageStyle'  "
                );
            }
        }


        axios.get('/api/news/' + id)
            .then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                newsTitle = res.data.Title;
                document.getElementById("newsTitle").innerHTML = newsTitle;
                document.getElementById("author").innerHTML = "作者:" + res.data.AuthorLabel;
                document.getElementById("time").innerHTML = "时间:" + time2String(new Date(res.data.Creattime * 1000));
                document.getElementById("review").innerHTML = "阅览:" + res.data.review_num + "次";
                document.getElementById("description").innerHTML = "内容提要:" + res.data.Description;
                document.getElementById("content").innerHTML = formatContent(res.data.Content);
                if (res.data.Downfile.length > 0) {

                    document.getElementById("downfile").innerHTML = `<a href="` + res.data.Downfile + `  target="_blank"/> `;
                }


            });

    </script>
    <<!include:footer>>